/**
 * Created by dh.huang on 2016/9/8.
 */
angular.module('inspinia')
  .controller('scheduleCtrl',['$scope',function($scope){
    $scope.search = {};
    $scope.isShow = false;
    $scope.weekdays = [
      {
        id:'01',
        text:'一',
        name:'mon'
      },
      {
        id:'02',
        text:'二',
        name:'mon'
      },
      {
        id:'03',
        text:'三',
        name:'mon'
      },
      {
        id:'04',
        text:'四',
        name:'mon'
      },
      {
        id:'05',
        text:'五',
        name:'mon'
      }
    ];
    $scope.pins02 = [
      {
        id:'010',
        patientName:'jack',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'1',
      },
      {
        id:'011',
        patientName:'marry',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'012',
        patientName:'lucy',
        type:"su",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },

    ];
    $scope.pins = [
      {
        id:'001',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'1',
      },
      {
        id:'002',
        patientName:'碧瑶',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'003',
        patientName:'陆雪琪',
        type:"su",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'004',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'005',
        patientName:'张小凡',
        type:"da",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'006',
        patientName:'张小凡',
        type:"wa",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'007',
        patientName:'张小凡',
        type:"in",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'008',
        patientName:'张小凡',
        type:"pu",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'009',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'010',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'011',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'012',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'013',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      },
      {
        id:'014',
        patientName:'张小凡',
        type:"3D",
        project:'CT',
        totalTimes:20,
        currentTimes:4,
        doctor:'赵四',
        weekday:'2',
      }
    ];
    $scope.centerAnchor = true;
    $scope.onDropComplete=function(index,data,evt){
      var _index = $scope.pins.indexOf(data);
      if (_index == -1){
        $scope.pins.splice(index,0,data);
      }
      var _index02 = $scope.pins02.indexOf(data);
      if (_index02 > -1) {
        $scope.pins02.splice(_index02, 1);
      }
    }

    $scope.edit = function(){
      $scope.isShow = true;
    };
    $scope.save = function(){
      $scope.isShow = false;
    };
  }])
